import java.util.*;
import java.util.Map.Entry;

class Test{
    	public static void main(String[] args) {
        HashMap<String,Integer> map = new HashMap<>();
        //Map map = new HashMap();
        map.put("A",1);
        map.put("B",2);
        map.put("C",3);
        
        //1,entrySet
//        Set entrySet = map.entrySet();
//        Iterator iterator1 = entrySet.iterator();
//        while(iterator1.hasNext()){
//            Object obj = iterator1.next();  
//
//            Map.Entry entry = (Map.Entry)obj;
//            System.out.println(entry.getKey()+"---->"+entry.getValue());
//        }
        //2,keyset
//        Set keySet = map.keySet();
//        Iterator iterator2 = keySet.iterator();
//        while(iterator2.hasNext()){
//            Object key = iterator2.next();
//            Object value = map.get(key);
//            System.out.println(key+"--->"+value);
//        }

//        3,foreach+lamdna                                    (a,b) -> {a+b}
           map.forEach((key, value) -> {
	            System.out.println(key + ":" + value);
	        });
    }
}

